package org.hackystat.devcathlon.ui.page.login;

import org.apache.wicket.behavior.HeaderContributor;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
//import org.hackystat.devcathlon.engine.match.MatchManager;
import org.hackystat.devcathlon.engine.match.Match;
import org.hackystat.devcathlon.ui.DevcathlonSession;
//import org.hackystat.devcathlon.ui.page.matches.MatchesPanel;
import org.hackystat.devcathlon.ui.page.matches.MatchesSession;
import org.hackystat.devcathlon.ui.page.scoreboard.commentpanel.FrontCommentPanel;
import org.hackystat.devcathlon.ui.page.scoreboard.eventspanel.EventsPanel;
import org.hackystat.devcathlon.ui.page.scoreboard.gameinfopanel.GameInfoPanel;
import org.hackystat.devcathlon.ui.page.scoreboard.halloffame.MostDeveloperPointsPanel;
import org.hackystat.devcathlon.ui.page.scoreboard.halloffame.MostPopularEventsPanel;
import org.hackystat.devcathlon.ui.page.scoreboard.halloffame.MostTeamPointsPanel;
import org.hackystat.devcathlon.ui.page.scoreboard.halloffame.MostTeamWinsPanel;
import org.hackystat.devcathlon.ui.page.scoreboard.scorespanel.ScoresPanel;

/**
 * Provides a Home Page for signing in to Devcathlon. 
 * 
 * @author Philip Johnson, Scheller Sanchez, Phillip Lau
 */
public class LoginResponsePage extends WebPage {
  
  /** Support serialization. */
  private static final long serialVersionUID = 1L;
  /** The session state for this page. */
  //private MatchesSession session = DevcathlonSession.get().getMatchesSession();
  /** Need a instance of the match manager.*/
  //private MatchManager matchManager = MatchManager.getInstance();
  
  /**
   * Create the HomePage.
   * 
   * @param match A clicked match from the Scores panel if not logged in.
   */
  public LoginResponsePage(Match match) {
    MatchesSession session = DevcathlonSession.get().getMatchesSession();
    //MatchManager matchManager = MatchManager.getInstance();
    add(HeaderContributor.forCss(org.hackystat.devcathlon.ui.Start.class, 
        "page/style/boilerplate/screen.css", "screen"));
    add(HeaderContributor.forCss(org.hackystat.devcathlon.ui.Start.class, 
        "page/style/boilerplate/print.css", "print"));
    add(new Label("title", "Devcathlon"));
    /*
    add(new MatchesPanel("matches_panel", 
        MatchesSession.convertToMatchNames(MatchManager.getInstance().getUserMatches())));
    */
    add(new ScoresPanel("scores_panel", DevcathlonSession.get().getMatchesSession()
        .getMatchNames()));
    add(new GameInfoPanel("gameinfo_panel", DevcathlonSession.get().getMatchesSession()
        .getMatch(match.getName())));
    add(new EventsPanel("events_panel", DevcathlonSession.get().getMatchesSession()
        .getMatch(match.getName())));    //add(new PerformerPanel("performer_panel"));
    add(new FrontCommentPanel("comment_panel", session.getUserMatches()));
    //add(new ScoresPanel("scores_panel"));
    //add(new LoginPanel("login_panel"));
    add(new LoginForm("loginForm"));
    add(new MostPopularEventsPanel ("mostPopularEvents_panel"));
    add(new MostDeveloperPointsPanel ("mostDeveloperPoints_panel"));
    add(new MostTeamPointsPanel ("mostTeamPoints_panel"));
    add(new MostTeamWinsPanel ("mostTeamWins_panel"));
    
  }
  
  /*public String getMatchName() {
    Match
  }*/
}
